<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit - Firmware API: XBee</title>
<link href="mt_doxygen.css" rel="stylesheet" type="text/css" />
<link href="../resources/mt_doxytabs.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.header {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12pt;
	color: #222222;
}
-->
</style>
</head>

<body>
<table width="800" border="0">
    <tr>
      <td colspan="3">
        <form method="get" action="http://www.google.com/search">
          <div align="right">
            <input type="text"   name="q" size="25"
              maxlength="255" value="" />
            <input type="submit" value="Search" />
            <input type="hidden" name="sitesearch" value="makingthings.com/ref/firmware/html" />
          </div>
        </form>
       </td>
    </tr>
    <tr>
      <td><div align="center"><a href="http://www.makingthings.com">
				<img src="../resources/logo_brown_medium.png" alt="MakingThings"
									width="200" height="78" border="0" align="middle" longdesc="http://www.makingthings.com" /></a></div></td>
				<td><div align="center" class="header">
      		Make Controller Kit <br />
          Firmware API
      </div></td>
      <td><div align="center"><a href="http://www.makezine.com">
					<img src="../resources/make_logo.png" alt="MAKE Zine" 
										width="164" height="73" border="0" align="middle" longdesc="http://www.makezine.com" /></a></div></td>
    </tr>
</table>
</body>
</html>
<!-- Generated by Doxygen 1.5.4 -->
<script type="text/javascript">
<!--
function changeDisplayState (e){
  var num=this.id.replace(/[^[0-9]/g,'');
  var button=this.firstChild;
  var sectionDiv=document.getElementById('dynsection'+num);
  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
    sectionDiv.style.display='block';
    button.src='open.gif';
  }else{
    sectionDiv.style.display='none';
    button.src='closed.gif';
  }
}
function initDynSections(){
  var divs=document.getElementsByTagName('div');
  var sectionCounter=1;
  for(var i=0;i<divs.length-1;i++){
    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
      var header=divs[i];
      var section=divs[i+1];
      var button=header.firstChild;
      if (button!='IMG'){
        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
        button=document.createElement('img');
        divs[i].insertBefore(button,divs[i].firstChild);
      }
      header.style.cursor='pointer';
      header.onclick=changeDisplayState;
      header.id='dynheader'+sectionCounter;
      button.src='closed.gif';
      section.id='dynsection'+sectionCounter;
      section.style.display='none';
      section.style.marginLeft='14px';
      sectionCounter++;
    }
  }
}
window.onload = initDynSections;
-->
</script>
<div class="tabs">
  <ul>
    <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
    <li><a href="modules.html"><span>Modules</span></a></li>
    <li><a href="classes.html"><span>Data&nbsp;Structures</span></a></li>
    <li><a href="files.html"><span>Files</span></a></li>
    <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  </ul>
</div>
<h1>XBee<br>
<small>
[<a class="el" href="group___controller.html">Controller</a>]</small>
</h1>Communicate with XBee (Zigbee) wireless modules via the Make Controller's serial port.  
<a href="#_details">More...</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Modules</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee_packet_types.html">XBee Packet Types</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The different types of packet that can be used with the <a class="el" href="group___x_bee.html">XBee</a> subsystem. <br></td></tr>

<p>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gf99a020a130eed99733b529b8cdb84a8">XBee_SetActive</a> (int state)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Controls the active state of the <b>XBee</b> subsystem.  <a href="#gf99a020a130eed99733b529b8cdb84a8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gb9837489c49f82e3ca25f0da44c58a13">XBee_GetActive</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Read the active state of the <b>XBee</b> subsystem.  <a href="#gb9837489c49f82e3ca25f0da44c58a13"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833">XBee_GetPacket</a> (XBeePacket *packet, int timeout)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Receive an incoming XBee packet.  <a href="#gb6f350a2b5dea977c3ab6244e4984833"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g88dd9f12ff38f318e59ec8e8283a78d3">XBee_SendPacket</a> (XBeePacket *packet, int datalength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Send an XBee packet.  <a href="#g88dd9f12ff38f318e59ec8e8283a78d3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45">XBee_ResetPacket</a> (XBeePacket *packet)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Initialize a packet before reading into it.  <a href="#g066e28d0aaafb23eb1171bcdb31e5c45"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18">XBeeConfig_SetPacketApiMode</a> (int value)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set a module into packet API mode.  <a href="#gb3abc9b61091749d5aa7a48e8aa35e18"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g5d8c12d4fba507727eded9aad78f5126">XBeeConfig_RequestPacketApiMode</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query whether the module is in API mode.  <a href="#g5d8c12d4fba507727eded9aad78f5126"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g2c4ec9c048a04f7d7b46850377e51008">XBee_CreateATCommandPacket</a> (XBeePacket *packet, uint8 frameID, char *cmd, uint8 *params, uint8 datalength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A convenience function for creating an AT command packet.  <a href="#g2c4ec9c048a04f7d7b46850377e51008"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g2f0a97c1a7ce219eb7ccd807e8a860e2">XBeeConfig_RequestATResponse</a> (char *cmd)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the address of the module.  <a href="#g2f0a97c1a7ce219eb7ccd807e8a860e2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g2a1939254f9174e0ee2c33a4d2ff8ba3">XBeeConfig_SetIO</a> (int pin, int value)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Configure the IO settings on an XBee module.  <a href="#g2a1939254f9174e0ee2c33a4d2ff8ba3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g471f419a8be85dff56cb190ac1122df3">XBeeConfig_RequestIO</a> (int pin)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the configuration of an IO pin.  <a href="#g471f419a8be85dff56cb190ac1122df3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g64d16869ea926373568cc1c09c53b0fa">XBee_CreateTX16Packet</a> (XBeePacket *xbp, uint8 frameID, uint16 destination, uint8 options, uint8 *data, uint8 datalength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a packet to be transmitted with a 16-bit address.  <a href="#g64d16869ea926373568cc1c09c53b0fa"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gda9cdb29dfffba8aea12c8f9e5586237">XBee_CreateTX64Packet</a> (XBeePacket *xbp, uint8 frameID, uint64 destination, uint8 options, uint8 *data, uint8 datalength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a packet to be transmitted with a 64-bit address.  <a href="#gda9cdb29dfffba8aea12c8f9e5586237"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g90063926b2e0055e8476887828e8eaa4">XBee_ReadRX16Packet</a> (XBeePacket *xbp, uint16 *srcAddress, uint8 *sigstrength, uint8 *options, uint8 **data, uint8 *datalength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unpack the info from an incoming packet with a 16-bit address.  <a href="#g90063926b2e0055e8476887828e8eaa4"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g366e1d12df63ac0bb6b4fbf380c9311c">XBee_ReadRX64Packet</a> (XBeePacket *xbp, uint64 *srcAddress, uint8 *sigstrength, uint8 *options, uint8 **data, uint8 *datalength)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unpack the info from an incoming packet with a 64-bit address.  <a href="#g366e1d12df63ac0bb6b4fbf380c9311c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gdc33b8d4803250488422484b2129f659">XBee_ReadIO16Packet</a> (XBeePacket *xbp, uint16 *srcAddress, uint8 *sigstrength, uint8 *options, int *samples)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unpack the info from an incoming IO packet with a 16-bit address.  <a href="#gdc33b8d4803250488422484b2129f659"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#ga54eca4b48efbf8f8080203f9930c1cd">XBee_ReadIO64Packet</a> (XBeePacket *xbp, uint64 *srcAddress, uint8 *sigstrength, uint8 *options, int *samples)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unpack the info from an incoming IO packet with a 64-bit address.  <a href="#ga54eca4b48efbf8f8080203f9930c1cd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gfc6ae9ae046640c29bc29f18d01f9a04">XBee_ReadAtResponsePacket</a> (XBeePacket *xbp, uint8 *frameID, char **command, uint8 *status, uint8 **data)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unpack the info from an incoming AT Command Response packet.  <a href="#gfc6ae9ae046640c29bc29f18d01f9a04"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#ga9d737273a7ae0ab7240424b058fc639">XBee_ReadTXStatusPacket</a> (XBeePacket *xbp, uint8 *frameID, uint8 *status)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Unpack the info from TX Status packet.  <a href="#ga9d737273a7ae0ab7240424b058fc639"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g60564c155b8d6a6e73a9bfa54917ebd2">XBeeConfig_WriteStateToMemory</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Save the configuration changes you've made on the module to memory.  <a href="#g60564c155b8d6a6e73a9bfa54917ebd2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gf6eb50d7c632ccadf35d89bebf30ba4a">XBeeConfig_SetAddress</a> (uint16 address)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set this module's address.  <a href="#gf6eb50d7c632ccadf35d89bebf30ba4a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gcca92909fdf6d844af5da5a13b1d1303">XBeeConfig_RequestAddress</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the address of the module.  <a href="#gcca92909fdf6d844af5da5a13b1d1303"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gbb8511090eee4d72a26bf55fb44bcd68">XBeeConfig_SetPanID</a> (uint16 id)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set this PAN (Personal Area Network) ID.  <a href="#gbb8511090eee4d72a26bf55fb44bcd68"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gd24a98ab72e3e7767982e59ba663c003">XBeeConfig_RequestPanID</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the PAN ID of the module.  <a href="#gd24a98ab72e3e7767982e59ba663c003"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gd5fd4ac5a68e76d7a16b3e685f05a4f8">XBeeConfig_SetChannel</a> (uint8 channel)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the module's channel.  <a href="#gd5fd4ac5a68e76d7a16b3e685f05a4f8"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#ga893d7c545c7b39c0f6909be757751fd">XBeeConfig_RequestChannel</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the channel of the module.  <a href="#ga893d7c545c7b39c0f6909be757751fd"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g35826df514efda2aab33f86cf0e24f2e">XBeeConfig_SetSampleRate</a> (uint16 rate)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the rate at which the module will sample its IO pins.  <a href="#g35826df514efda2aab33f86cf0e24f2e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#g00ce3bb898806b5cf6bb257dfb24ca9c">XBeeConfig_RequestSampleRate</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Query the sample rate of the module.  <a href="#g00ce3bb898806b5cf6bb257dfb24ca9c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group___x_bee.html#gd357b57c2604013a69ec60e746318f89">XBee_IntToBigEndianArray</a> (int value, uint8 *array)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Convert a 32-bit integer into a big endian array of 4 unsigned 8-bit integers.  <a href="#gd357b57c2604013a69ec60e746318f89"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Communicate with XBee (Zigbee) wireless modules via the Make Controller's serial port. 
<p>
XBee modules from <b>MaxStream</b> are small, cheap ($19 each), wireless <b>RF</b> (radio frequency) modules that can easily be used with the Make Controller Kit to create projects that require wireless communication. Check <a href="http://www.maxstream.net/products/xbee/xbee-oem-rf-module-zigbee.php">http://www.maxstream.net/products/xbee/xbee-oem-rf-module-zigbee.php</a> for more info.<h2><a class="anchor" name="Overview">
Overview</a></h2>
XBee modules are <b>ZigBee/IEEE 802.15.4</b> compliant and can operate in several modes:<ul>
<li>Transparent serial port. Messages in one side magically end up at the other endpoint. Great for enabling wireless communication between 2 Make Controllers.</li><li>AT command mode. Send traditional AT commands to configure the module itself (as opposed to having the data go straight through via serial mode.</li><li>Packet (API) mode. Lower level communication that doesn't have to wait for the module to be in AT command mode. Check the <a class="el" href="group___x_bee_packet_types.html">XBee Packet Types</a> for a description of how these packets are laid out. Be sure to call XBeeConfig_SetPacketApiMode before trying to do anything in this mode.</li></ul>
<p>
The general idea is that you have one XBee module connected directly to your Make Controller Kit, and then any number of other XBee modules that can communicate with it in order to get information to and from the Make Controller. Or, several Make Controllers can each have an XBee module connected in order to communicate wirelessly among themselves.<p>
XBee modules also have some digital and analog I/O right on them, which means you can directly connect sensors to the XBee modules which will both read the values and send them wirelessly. Check the XBee doc for the appropriate commands to send in order to set this up.<h2><a class="anchor" name="API">
API</a></h2>
The Make Controller API for working with the XBee modules makes use of the XBee Packet API. If you simply want to make use of the transparent serial port functionality, you don't need to deal with any of this - simply hook up the module to your Make Controller and start reading and writing over the serial port.<p>
The XBee Packet API allows for much more flexible and powerful communication with the modules. It uses AT commands to configure the XBee module itself, and then a handful of Zigbee specified packet types can be sent and received. See <a class="el" href="group___x_bee_packet_types.html">XBee Packet Types</a> for details on these packet types.<p>
The <b>XBeeConfig_</b> functions are convenient wrappers around some of the most common AT commands you might want to send. For any of the other AT commands, check the XBee documentation and create them using <a class="el" href="group___x_bee.html#g2c4ec9c048a04f7d7b46850377e51008" title="A convenience function for creating an AT command packet.">XBee_CreateATCommandPacket( )</a>. These will always be send to the XBee module attached to the Make Controller. The <b>XBee_</b> functions deal with sending and receiving messages to other XBee modules not connected to the Make Controller. <hr><h2>Function Documentation</h2>
<a class="anchor" name="g2c4ec9c048a04f7d7b46850377e51008"></a><!-- doxytag: member="xbee.c::XBee_CreateATCommandPacket" ref="g2c4ec9c048a04f7d7b46850377e51008" args="(XBeePacket *packet, uint8 frameID, char *cmd, uint8 *params, uint8 datalength)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBee_CreateATCommandPacket           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>packet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>frameID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>cmd</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>params</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>datalength</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
A convenience function for creating an AT command packet. 
<p>
As per the XBee spec, AT Command packets that want to set/write a value must have 4 bytes of data. Packets that query the value of an AT parameter send 0 bytes of data. Note that multi-byte data must be sent <b>big-endian</b> (most significant byte first) - see <a class="el" href="group___x_bee.html#gd357b57c2604013a69ec60e746318f89" title="Convert a 32-bit integer into a big endian array of 4 unsigned 8-bit integers.">XBee_IntToBigEndianArray( )</a>.<p>
Make sure you're in API mode before creating &amp; sending packets - see <a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a>. See the XBee documentation for the official list of AT commands that the XBee modules understand. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>packet</em>&nbsp;</td><td>The XBeePacket to create. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>frameID</em>&nbsp;</td><td>The frame ID for this packet that subsequent response/status messages can refer to. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>cmd</em>&nbsp;</td><td>The 2-character AT command. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>params</em>&nbsp;</td><td>A pointer to the buffer containing the data to be sent. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>datalength</em>&nbsp;</td><td>The number of bytes to send from the params buffer. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer specifying the active state - 1 (active) or 0 (inactive).</dd></dl>
<dl class="user" compact><dt><b>Example - Writing</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket txPacket;
  uint8 params[4];
  <a class="code" href="group___x_bee.html#gd357b57c2604013a69ec60e746318f89" title="Convert a 32-bit integer into a big endian array of 4 unsigned 8-bit integers.">XBee_IntToBigEndianArray</a>( 1000, params ); <span class="comment">// set our sampling rate to 1000</span>
  <a class="code" href="group___x_bee.html#g2c4ec9c048a04f7d7b46850377e51008" title="A convenience function for creating an AT command packet.">XBee_CreateATCommandPacket</a>( &amp;txPacket, 0, <span class="stringliteral">"IR"</span>, &amp;params, 4 ); <span class="comment">// set the sampling rate of the IO pins</span>
  <a class="code" href="group___x_bee.html#g88dd9f12ff38f318e59ec8e8283a78d3" title="Send an XBee packet.">XBee_SendPacket</a>( &amp;txPacket, 4 );
</pre></div></dd></dl>
<dl class="user" compact><dt><b>Example - Reading</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket txPacket;
  <a class="code" href="group___x_bee.html#g2c4ec9c048a04f7d7b46850377e51008" title="A convenience function for creating an AT command packet.">XBee_CreateATCommandPacket</a>( &amp;txPacket, 0, <span class="stringliteral">"IR"</span>, NULL, 0 ); <span class="comment">// query the sampling rate of the IO pins</span>
  <a class="code" href="group___x_bee.html#g88dd9f12ff38f318e59ec8e8283a78d3" title="Send an XBee packet.">XBee_SendPacket</a>( &amp;txPacket, 0 );
  <span class="comment">// then we'll receive a response packet</span>
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00384">384</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g64d16869ea926373568cc1c09c53b0fa"></a><!-- doxytag: member="xbee.c::XBee_CreateTX16Packet" ref="g64d16869ea926373568cc1c09c53b0fa" args="(XBeePacket *xbp, uint8 frameID, uint16 destination, uint8 options, uint8 *data, uint8 datalength)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_CreateTX16Packet           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>frameID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16&nbsp;</td>
          <td class="paramname"> <em>destination</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>options</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>datalength</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create a packet to be transmitted with a 16-bit address. 
<p>
If the <b>frameID</b> is 0, you won't receive a TX Status message in response.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to create. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>frameID</em>&nbsp;</td><td>The frame ID for this packet that subsequent response/status messages can refer to. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>destination</em>&nbsp;</td><td>The destination address for this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>The XBee options for this packet (0 if none). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A pointer to the data to be sent in this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>datalength</em>&nbsp;</td><td>The number of bytes of data to be sent. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket txPacket;
  uint8 data[] = <span class="stringliteral">"ABC"</span>;
  <a class="code" href="group___x_bee.html#g64d16869ea926373568cc1c09c53b0fa" title="Create a packet to be transmitted with a 16-bit address.">XBee_CreateTX16Packet</a>( &amp;txPacket, 0x52, 0, 0, data, 3 );
  <a class="code" href="group___x_bee.html#g88dd9f12ff38f318e59ec8e8283a78d3" title="Send an XBee packet.">XBee_SendPacket</a>( &amp;txPacket, 3 );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00492">492</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gda9cdb29dfffba8aea12c8f9e5586237"></a><!-- doxytag: member="xbee.c::XBee_CreateTX64Packet" ref="gda9cdb29dfffba8aea12c8f9e5586237" args="(XBeePacket *xbp, uint8 frameID, uint64 destination, uint8 options, uint8 *data, uint8 datalength)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_CreateTX64Packet           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>frameID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64&nbsp;</td>
          <td class="paramname"> <em>destination</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>options</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>datalength</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create a packet to be transmitted with a 64-bit address. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to create. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>frameID</em>&nbsp;</td><td>The frame ID for this packet that subsequent response/status messages can refer to. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>destination</em>&nbsp;</td><td>The destination address for this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>The XBee options for this packet (0 if none). </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A pointer to the data to be sent in this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>datalength</em>&nbsp;</td><td>The number of bytes of data to be sent. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket txPacket;
  uint8 data[] = <span class="stringliteral">"ABCDE"</span>;
  <a class="code" href="group___x_bee.html#g64d16869ea926373568cc1c09c53b0fa" title="Create a packet to be transmitted with a 16-bit address.">XBee_CreateTX16Packet</a>( &amp;txPacket, 0, 0, 0, data, 5 );
  <a class="code" href="group___x_bee.html#g88dd9f12ff38f318e59ec8e8283a78d3" title="Send an XBee packet.">XBee_SendPacket</a>( &amp;txPacket, 5 );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00525">525</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gb9837489c49f82e3ca25f0da44c58a13"></a><!-- doxytag: member="xbee.c::XBee_GetActive" ref="gb9837489c49f82e3ca25f0da44c58a13" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBee_GetActive           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Read the active state of the <b>XBee</b> subsystem. 
<p>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer specifying the active state - 1 (active) or 0 (inactive). </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00121">121</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gb6f350a2b5dea977c3ab6244e4984833"></a><!-- doxytag: member="xbee.c::XBee_GetPacket" ref="gb6f350a2b5dea977c3ab6244e4984833" args="(XBeePacket *packet, int timeout)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBee_GetPacket           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>packet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>timeout</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Receive an incoming XBee packet. 
<p>
A single call to this will continue to read from the serial port as long as there are characters to read or until it times out. If a packet has not been completely received, call it repeatedly with the same packet.<p>
Clear out a packet before reading into it with a call to <a class="el" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket( )</a> <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>packet</em>&nbsp;</td><td>The XBeePacket to receive into. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>The number of milliseconds to wait for a packet to arrive. Set this to 0 to return as soon as there are no characters left to process. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>1 if a complete packet has been received, 0 if not. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a></dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// we're inside a task here...</span>
  XBeePacket myPacket;
  <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;myPacket );
  <span class="keywordflow">while</span>( 1 )
  {
    <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( &amp;myPacket, 100 ) )
    {
      <span class="comment">// process the new packet</span>
      <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;myPacket ); <span class="comment">// then clear it out before reading again</span>
    }
    <a class="code" href="group___tasks.html#g9a64a7c0e24f257826103d1d1bbb44fa" title="Put a task to sleep for a given number of milliseconds.">Sleep</a>( 10 );
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00155">155</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gd357b57c2604013a69ec60e746318f89"></a><!-- doxytag: member="xbee.c::XBee_IntToBigEndianArray" ref="gd357b57c2604013a69ec60e746318f89" args="(int value, uint8 *array)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBee_IntToBigEndianArray           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>array</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Convert a 32-bit integer into a big endian array of 4 unsigned 8-bit integers. 
<p>
This is mostly useful for sending AT Command packets. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>The value to convert. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>array</em>&nbsp;</td><td>An array of 4 unsigned 8-bit integers (uint8). Be sure you have 4. </td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd>see <a class="el" href="group___x_bee.html#g2c4ec9c048a04f7d7b46850377e51008" title="A convenience function for creating an AT command packet.">XBee_CreateATCommandPacket( )</a> for an example.  </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l01059">1059</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gfc6ae9ae046640c29bc29f18d01f9a04"></a><!-- doxytag: member="xbee.c::XBee_ReadAtResponsePacket" ref="gfc6ae9ae046640c29bc29f18d01f9a04" args="(XBeePacket *xbp, uint8 *frameID, char **command, uint8 *status, uint8 **data)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_ReadAtResponsePacket           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>frameID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char **&nbsp;</td>
          <td class="paramname"> <em>command</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>status</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 **&nbsp;</td>
          <td class="paramname"> <em>data</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unpack the info from an incoming AT Command Response packet. 
<p>
In response to a previous AT Command message, the module will send an AT Command Response message.<p>
Pass <b>NULL</b> into any of the parameters you don't care about. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to read from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>frameID</em>&nbsp;</td><td>A pointer to a uint64 that will be filled up with the 16-bit address of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>command</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the signal strength of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>status</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the XBee options for this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A pointer that will be set to the data of this packet. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket rxPacket;
  <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( &amp;rxPacket, 0 ) )
  {
    uint8 frameID;
    <span class="keywordtype">char</span>* command;
    uint8 status;
    uint8* data;
    <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gfc6ae9ae046640c29bc29f18d01f9a04" title="Unpack the info from an incoming AT Command Response packet.">XBee_ReadAtResponsePacket</a>( &amp;rxPacket, &amp;frameID, command, &amp;status, &amp;data ) )
    {
      <span class="comment">// then process the new packet here</span>
      <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;rxPacket ); <span class="comment">// and clear it out before reading again</span>
    }
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00782">782</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gdc33b8d4803250488422484b2129f659"></a><!-- doxytag: member="xbee.c::XBee_ReadIO16Packet" ref="gdc33b8d4803250488422484b2129f659" args="(XBeePacket *xbp, uint16 *srcAddress, uint8 *sigstrength, uint8 *options, int *samples)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_ReadIO16Packet           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16 *&nbsp;</td>
          <td class="paramname"> <em>srcAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>sigstrength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>options</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>samples</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unpack the info from an incoming IO packet with a 16-bit address. 
<p>
When an XBee module has been given a sample rate, it will sample its IO pins according to their current configuration and send an IO packet with the sample data. This function will extract the sample info into an array of ints for you. There are 9 IO pins on the XBee modules, so be sure that the array you pass in has room for 9 ints.<p>
Pass <b>NULL</b> into any of the parameters you don't care about. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to read from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>srcAddress</em>&nbsp;</td><td>A pointer to a uint16 that will be filled up with the 16-bit address of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sigstrength</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the signal strength of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the XBee options for this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>samples</em>&nbsp;</td><td>A pointer to an array of ints that will be filled up with the sample values from this packet. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#g35826df514efda2aab33f86cf0e24f2e" title="Set the rate at which the module will sample its IO pins.">XBeeConfig_SetSampleRate( )</a>, XBeeConfig_SetIOs( )</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket rxPacket;
  <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( &amp;rxPacket, 0 ) )
  {
    uint16 src;
    uint8 sigstrength;
    <span class="keywordtype">int</span> samples[9];
    <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gdc33b8d4803250488422484b2129f659" title="Unpack the info from an incoming IO packet with a 16-bit address.">XBee_ReadIO16Packet</a>( &amp;rxPacket, &amp;src, &amp;sigstrength, NULL, samples ) )
    {
      <span class="comment">// then process the new packet here</span>
      <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;rxPacket ); <span class="comment">// and clear it out before reading again</span>
    }
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00675">675</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="ga54eca4b48efbf8f8080203f9930c1cd"></a><!-- doxytag: member="xbee.c::XBee_ReadIO64Packet" ref="ga54eca4b48efbf8f8080203f9930c1cd" args="(XBeePacket *xbp, uint64 *srcAddress, uint8 *sigstrength, uint8 *options, int *samples)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_ReadIO64Packet           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64 *&nbsp;</td>
          <td class="paramname"> <em>srcAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>sigstrength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>options</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&nbsp;</td>
          <td class="paramname"> <em>samples</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unpack the info from an incoming IO packet with a 64-bit address. 
<p>
When an XBee module has been given a sample rate, it will sample its IO pins according to their current configuration and send an IO packet with the sample data. This function will extract the sample info into an array of ints for you. There are 9 IO pins on the XBee modules, so be sure that the array you pass in has room for 9 ints.<p>
Pass <b>NULL</b> into any of the parameters you don't care about. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to read from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>srcAddress</em>&nbsp;</td><td>A pointer to a uint64 that will be filled up with the 16-bit address of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sigstrength</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the signal strength of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the XBee options for this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>samples</em>&nbsp;</td><td>A pointer to an array of ints that will be filled up with the sample values from this packet. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#g35826df514efda2aab33f86cf0e24f2e" title="Set the rate at which the module will sample its IO pins.">XBeeConfig_SetSampleRate( )</a>, XBeeConfig_SetIOs( )</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket rxPacket;
  <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( &amp;rxPacket, 0 ) )
  {
    uint64 src;
    uint8 sigstrength;
    <span class="keywordtype">int</span> samples[9];
    <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gdc33b8d4803250488422484b2129f659" title="Unpack the info from an incoming IO packet with a 16-bit address.">XBee_ReadIO16Packet</a>( &amp;rxPacket, &amp;src, &amp;sigstrength, NULL, samples ) )
    {
      <span class="comment">// then process the new packet here</span>
      <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;rxPacket ); <span class="comment">// and clear it out before reading again</span>
    }
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00728">728</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g90063926b2e0055e8476887828e8eaa4"></a><!-- doxytag: member="xbee.c::XBee_ReadRX16Packet" ref="g90063926b2e0055e8476887828e8eaa4" args="(XBeePacket *xbp, uint16 *srcAddress, uint8 *sigstrength, uint8 *options, uint8 **data, uint8 *datalength)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_ReadRX16Packet           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16 *&nbsp;</td>
          <td class="paramname"> <em>srcAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>sigstrength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>options</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 **&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>datalength</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unpack the info from an incoming packet with a 16-bit address. 
<p>
Pass <b>NULL</b> into any of the parameters you don't care about. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to read from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>srcAddress</em>&nbsp;</td><td>The 16-bit address of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sigstrength</em>&nbsp;</td><td>The signal strength of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>The XBee options for this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A pointer that will be set to the data of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>datalength</em>&nbsp;</td><td>The length of data in this packet. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket rxPacket;
  <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( &amp;rxPacket, 0 ) )
  {
    uint16 src;
    uint8 sigstrength;
    uint8* data;
    uint8 datalength;
    <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#g90063926b2e0055e8476887828e8eaa4" title="Unpack the info from an incoming packet with a 16-bit address.">XBee_ReadRX16Packet</a>( &amp;rxPacket, &amp;src, &amp;sigstrength, NULL, &amp;data, &amp;datalength ) )
    {
      <span class="comment">// then process the new packet here</span>
      <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;rxPacket ); <span class="comment">// and clear it out before reading again</span>
    }
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00569">569</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g366e1d12df63ac0bb6b4fbf380c9311c"></a><!-- doxytag: member="xbee.c::XBee_ReadRX64Packet" ref="g366e1d12df63ac0bb6b4fbf380c9311c" args="(XBeePacket *xbp, uint64 *srcAddress, uint8 *sigstrength, uint8 *options, uint8 **data, uint8 *datalength)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_ReadRX64Packet           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint64 *&nbsp;</td>
          <td class="paramname"> <em>srcAddress</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>sigstrength</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>options</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 **&nbsp;</td>
          <td class="paramname"> <em>data</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>datalength</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unpack the info from an incoming packet with a 64-bit address. 
<p>
Pass <b>NULL</b> into any of the parameters you don't care about. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to read from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>srcAddress</em>&nbsp;</td><td>The 64-bit address of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>sigstrength</em>&nbsp;</td><td>The signal strength of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>options</em>&nbsp;</td><td>The XBee options for this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>data</em>&nbsp;</td><td>A pointer that will be set to the data of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>datalength</em>&nbsp;</td><td>The length of data in this packet. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket rxPacket;
  <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( &amp;rxPacket, 0 ) )
  {
    uint64 src;
    uint8 sigstrength;
    uint8* data;
    uint8 datalength;
    <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#g366e1d12df63ac0bb6b4fbf380c9311c" title="Unpack the info from an incoming packet with a 64-bit address.">XBee_ReadRX64Packet</a>( &amp;rxPacket, &amp;src, &amp;sigstrength, NULL, &amp;data, &amp;datalength ) )
    {
      <span class="comment">// then process the new packet here</span>
      <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;rxPacket ); <span class="comment">// and clear it out before reading again</span>
    }
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00619">619</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="ga9d737273a7ae0ab7240424b058fc639"></a><!-- doxytag: member="xbee.c::XBee_ReadTXStatusPacket" ref="ga9d737273a7ae0ab7240424b058fc639" args="(XBeePacket *xbp, uint8 *frameID, uint8 *status)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool XBee_ReadTXStatusPacket           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>xbp</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>frameID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8 *&nbsp;</td>
          <td class="paramname"> <em>status</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Unpack the info from TX Status packet. 
<p>
When a TX is completed, the modules esnds a TX Status message. This indicates whether the packet was transmitted successfully or not. If the message you sent had a frameID of 0, a TX status message will not be generated.<p>
Pass <b>NULL</b> into any of the parameters you don't care about. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>xbp</em>&nbsp;</td><td>The XBeePacket to read from. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>frameID</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the frame ID of this packet. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>status</em>&nbsp;</td><td>A pointer to a uint8 that will be filled up with the status of this packet. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket rxPacket;
  <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket</a>( &amp;rxPacket, 0 ) )
  {
    uint8 frameID;
    uint8 status;
    <span class="keywordflow">if</span>( <a class="code" href="group___x_bee.html#ga9d737273a7ae0ab7240424b058fc639" title="Unpack the info from TX Status packet.">XBee_ReadTXStatusPacket</a>( &amp;rxPacket, &amp;frameID, &amp;status ) )
    {
      <span class="comment">// then process the new packet here</span>
      <a class="code" href="group___x_bee.html#g066e28d0aaafb23eb1171bcdb31e5c45" title="Initialize a packet before reading into it.">XBee_ResetPacket</a>( &amp;rxPacket ); <span class="comment">// and clear it out before reading again</span>
    }
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00823">823</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g066e28d0aaafb23eb1171bcdb31e5c45"></a><!-- doxytag: member="xbee.c::XBee_ResetPacket" ref="g066e28d0aaafb23eb1171bcdb31e5c45" args="(XBeePacket *packet)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBee_ResetPacket           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>packet</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Initialize a packet before reading into it. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>packet</em>&nbsp;</td><td>The XBeePacket to initialize. </td></tr>
  </table>
</dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#gb6f350a2b5dea977c3ab6244e4984833" title="Receive an incoming XBee packet.">XBee_GetPacket( )</a> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00274">274</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g88dd9f12ff38f318e59ec8e8283a78d3"></a><!-- doxytag: member="xbee.c::XBee_SendPacket" ref="g88dd9f12ff38f318e59ec8e8283a78d3" args="(XBeePacket *packet, int datalength)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBee_SendPacket           </td>
          <td>(</td>
          <td class="paramtype">XBeePacket *&nbsp;</td>
          <td class="paramname"> <em>packet</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>datalength</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Send an XBee packet. 
<p>
Use the following functions to create packets to be sent:<ul>
<li><a class="el" href="group___x_bee.html#g64d16869ea926373568cc1c09c53b0fa" title="Create a packet to be transmitted with a 16-bit address.">XBee_CreateTX16Packet( )</a> - create a data packet to be sent out wirelessly with a 16-bit address</li><li><a class="el" href="group___x_bee.html#gda9cdb29dfffba8aea12c8f9e5586237" title="Create a packet to be transmitted with a 64-bit address.">XBee_CreateTX64Packet( )</a> - create a data packet to be sent out wirelessly with a 64-bit address</li><li><a class="el" href="group___x_bee.html#g2c4ec9c048a04f7d7b46850377e51008" title="A convenience function for creating an AT command packet.">XBee_CreateATCommandPacket( )</a> - create an AT command to configure an attached XBee module <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>packet</em>&nbsp;</td><td>The XBeePacket to send. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>datalength</em>&nbsp;</td><td>The length of the actual data being sent (not including headers, options, etc.) </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Zero on success. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a></dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  XBeePacket txPacket;
  uint8 data[] = <span class="stringliteral">"ABC"</span>; <span class="comment">// 3 bytes of data</span>
  <a class="code" href="group___x_bee.html#g64d16869ea926373568cc1c09c53b0fa" title="Create a packet to be transmitted with a 16-bit address.">XBee_CreateTX16Packet</a>( &amp;txPacket, 0, 0, 0, data, 3 );
  <a class="code" href="group___x_bee.html#g88dd9f12ff38f318e59ec8e8283a78d3" title="Send an XBee packet.">XBee_SendPacket</a>( &amp;txPacket, 3 );
</pre></div> </dd></dl>
</li></ul>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00232">232</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gf99a020a130eed99733b529b8cdb84a8"></a><!-- doxytag: member="xbee.c::XBee_SetActive" ref="gf99a020a130eed99733b529b8cdb84a8" args="(int state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBee_SetActive           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>state</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Controls the active state of the <b>XBee</b> subsystem. 
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>state</em>&nbsp;</td><td>Whether this subsystem is active or not </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>Zero on success. </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00088">88</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gcca92909fdf6d844af5da5a13b1d1303"></a><!-- doxytag: member="xbee.c::XBeeConfig_RequestAddress" ref="gcca92909fdf6d844af5da5a13b1d1303" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBeeConfig_RequestAddress           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Query the address of the module. 
<p>
This will block for up to a 1/2 second waiting for a response from the XBee module. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer corresponding to the address of the module, or negative number on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> address = <a class="code" href="group___x_bee.html#gcca92909fdf6d844af5da5a13b1d1303" title="Query the address of the module.">XBeeConfig_RequestAddress</a>( );
  <span class="keywordflow">if</span>( address &gt;= 0 )
  {
    <span class="comment">// then we have our address</span>
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00897">897</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g2f0a97c1a7ce219eb7ccd807e8a860e2"></a><!-- doxytag: member="xbee.c::XBeeConfig_RequestATResponse" ref="g2f0a97c1a7ce219eb7ccd807e8a860e2" args="(char *cmd)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBeeConfig_RequestATResponse           </td>
          <td>(</td>
          <td class="paramtype">char *&nbsp;</td>
          <td class="paramname"> <em>cmd</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Query the address of the module. 
<p>
This will block for up to a 1/2 second waiting for a response from the XBee module. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer corresponding to the address of the module, or negative number on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> address = <a class="code" href="group___x_bee.html#gcca92909fdf6d844af5da5a13b1d1303" title="Query the address of the module.">XBeeConfig_RequestAddress</a>( );
  <span class="keywordflow">if</span>( address &gt;= 0 )
  {
    <span class="comment">// then we have our address</span>
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00410">410</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="ga893d7c545c7b39c0f6909be757751fd"></a><!-- doxytag: member="xbee.c::XBeeConfig_RequestChannel" ref="ga893d7c545c7b39c0f6909be757751fd" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBeeConfig_RequestChannel           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Query the channel of the module. 
<p>
This will block for up to a 1/2 second waiting for a response from the XBee module. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer corresponding to the channel of the module, or negative number on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> chan = <a class="code" href="group___x_bee.html#ga893d7c545c7b39c0f6909be757751fd" title="Query the channel of the module.">XBeeConfig_RequestChannel</a>( );
  <span class="keywordflow">if</span>( chan &gt;= 0 )
  {
    <span class="comment">// then we have our channel</span>
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00994">994</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g471f419a8be85dff56cb190ac1122df3"></a><!-- doxytag: member="xbee.c::XBeeConfig_RequestIO" ref="g471f419a8be85dff56cb190ac1122df3" args="(int pin)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBeeConfig_RequestIO           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pin</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Query the configuration of an IO pin. 
<p>
See <a class="el" href="group___x_bee.html#g2a1939254f9174e0ee2c33a4d2ff8ba3" title="Configure the IO settings on an XBee module.">XBeeConfig_SetIO( )</a> for the possible return values. This will block for up to a 1/2 second waiting for a response from the XBee module. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer corresponding to the config of the requested pin, or negative number on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> pin = <a class="code" href="group___x_bee.html#g471f419a8be85dff56cb190ac1122df3" title="Query the configuration of an IO pin.">XBeeConfig_RequestIO</a>( 0 ); <span class="comment">// request the configuration of pin 0</span>
  <span class="keywordflow">if</span>( pin &gt;= 0 )
  {
    <span class="comment">// then we have our pin config</span>
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00462">462</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g5d8c12d4fba507727eded9aad78f5126"></a><!-- doxytag: member="xbee.c::XBeeConfig_RequestPacketApiMode" ref="g5d8c12d4fba507727eded9aad78f5126" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBeeConfig_RequestPacketApiMode           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Query whether the module is in API mode. 
<p>
This will block for up to a 1/2 second waiting for a response from the XBee module. <dl class="return" compact><dt><b>Returns:</b></dt><dd>0 if off, 1 if enabled, 2 if enabled with escape characters.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> mode = <a class="code" href="group___x_bee.html#g5d8c12d4fba507727eded9aad78f5126" title="Query whether the module is in API mode.">XBeeConfig_RequestPacketApiMode</a>( );
  <span class="keywordflow">if</span>( mode &gt;= 0 )
  {
    <span class="comment">// then we have our mode</span>
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00344">344</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gd24a98ab72e3e7767982e59ba663c003"></a><!-- doxytag: member="xbee.c::XBeeConfig_RequestPanID" ref="gd24a98ab72e3e7767982e59ba663c003" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBeeConfig_RequestPanID           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Query the PAN ID of the module. 
<p>
This will block for up to a 1/2 second waiting for a response from the XBee module. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer corresponding to the PAN ID of the module, or negative number on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> panid = <a class="code" href="group___x_bee.html#gd24a98ab72e3e7767982e59ba663c003" title="Query the PAN ID of the module.">XBeeConfig_RequestPanID</a>( );
  <span class="keywordflow">if</span>( panid &gt;= 0 )
  {
    <span class="comment">// then we have our pan id</span>
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00944">944</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g00ce3bb898806b5cf6bb257dfb24ca9c"></a><!-- doxytag: member="xbee.c::XBeeConfig_RequestSampleRate" ref="g00ce3bb898806b5cf6bb257dfb24ca9c" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XBeeConfig_RequestSampleRate           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Query the sample rate of the module. 
<p>
This will block for up to a 1/2 second waiting for a response from the XBee module. <dl class="return" compact><dt><b>Returns:</b></dt><dd>An integer corresponding to the sample rate of the module, or negative number on failure.</dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="keywordtype">int</span> rate = <a class="code" href="group___x_bee.html#g00ce3bb898806b5cf6bb257dfb24ca9c" title="Query the sample rate of the module.">XBeeConfig_RequestSampleRate</a>( );
  <span class="keywordflow">if</span>( rate &gt;= 0 )
  {
    <span class="comment">// then we have our rate</span>
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l01042">1042</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gf6eb50d7c632ccadf35d89bebf30ba4a"></a><!-- doxytag: member="xbee.c::XBeeConfig_SetAddress" ref="gf6eb50d7c632ccadf35d89bebf30ba4a" args="(uint16 address)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBeeConfig_SetAddress           </td>
          <td>(</td>
          <td class="paramtype">uint16&nbsp;</td>
          <td class="paramname"> <em>address</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set this module's address. 
<p>
As with the other <b>XBeeConfig</b> functions, make sure you're in API mode before trying to use this function. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>address</em>&nbsp;</td><td>An integer specifying the module's address. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a></dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <a class="code" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode</a>( );
  <a class="code" href="group___x_bee.html#gf6eb50d7c632ccadf35d89bebf30ba4a" title="Set this module&amp;#39;s address.">XBeeConfig_SetAddress</a>( 100 );
  <a class="code" href="group___x_bee.html#g60564c155b8d6a6e73a9bfa54917ebd2" title="Save the configuration changes you&amp;#39;ve made on the module to memory.">XBeeConfig_WriteStateToMemory</a>( );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00874">874</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gd5fd4ac5a68e76d7a16b3e685f05a4f8"></a><!-- doxytag: member="xbee.c::XBeeConfig_SetChannel" ref="gd5fd4ac5a68e76d7a16b3e685f05a4f8" args="(uint8 channel)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBeeConfig_SetChannel           </td>
          <td>(</td>
          <td class="paramtype">uint8&nbsp;</td>
          <td class="paramname"> <em>channel</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the module's channel. 
<p>
The channel is one of 3 addressing options available to the module - the others are the PAN ID and the destination address. In order for modules to communicate with each other, the modules must share the same channel number. Default is <b>0x0C</b>.<p>
This value can have the range <b>0x0B</b> - <b>0x1A</b> for XBee modules, and <b>0x0C</b> - <b>0x17</b> for XBee-Pro modules.<p>
As with the other <b>XBeeConfig</b> functions, make sure you're in API mode before trying to use this function. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>channel</em>&nbsp;</td><td>A uint8 specifying the channel. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a></dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <a class="code" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode</a>( );
  <a class="code" href="group___x_bee.html#gd5fd4ac5a68e76d7a16b3e685f05a4f8" title="Set the module&amp;#39;s channel.">XBeeConfig_SetChannel</a>( 0x0D );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00971">971</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g2a1939254f9174e0ee2c33a4d2ff8ba3"></a><!-- doxytag: member="xbee.c::XBeeConfig_SetIO" ref="g2a1939254f9174e0ee2c33a4d2ff8ba3" args="(int pin, int value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBeeConfig_SetIO           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>pin</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>value</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Configure the IO settings on an XBee module. 
<p>
IO pins can have one of 5 values:<ul>
<li><b>XBEE_IO_DISABLED</b> </li><li><b>XBEE_IO_ANALOGIN</b> - Analog input (10-bit)</li><li><b>XBEE_IO_DIGITALIN</b> - Digital input</li><li><b>XBEE_IO_DIGOUT_HIGH</b> - Digital out high</li><li><b>XBEE_IO_DIGOUT_LOW</b> - Digital out low <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>pin</em>&nbsp;</td><td>An integer specifying which pin to configure. There are 9 IO pins (numbered 0-8) on the XBee modules. Only channels 0-7 can be analog inputs - channel 8 can only operate as a digital in or out. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>An int specifying the behavior of this pin (options shown above). </td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <span class="comment">// set channel 0 to analog in</span>
  <a class="code" href="group___x_bee.html#g2a1939254f9174e0ee2c33a4d2ff8ba3" title="Configure the IO settings on an XBee module.">XBeeConfig_SetIO</a>( 0, XBEE_IO_ANALOGIN );
</pre></div> </dd></dl>
</li></ul>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00435">435</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gb3abc9b61091749d5aa7a48e8aa35e18"></a><!-- doxytag: member="xbee.c::XBeeConfig_SetPacketApiMode" ref="gb3abc9b61091749d5aa7a48e8aa35e18" args="(int value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBeeConfig_SetPacketApiMode           </td>
          <td>(</td>
          <td class="paramtype">int&nbsp;</td>
          <td class="paramname"> <em>value</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set a module into packet API mode. 
<p>
XBee modules are in transparent serial port mode by default. This allows you to work with them via the packet API.<p>
When setting this on, the XBee module needs to wait 1 second after sending the command sequence before it's ready to receive any AT commands - this function will block for that amount of time. Once you turn it off, you won't get any responses to packets you send the module until you turn packet mode on again. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>value</em>&nbsp;</td><td>1 to turn packet mode on, 0 to turn it off.</td></tr>
  </table>
</dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  MyTask( <span class="keywordtype">void</span> * p )
  {
    <a class="code" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode</a>( 1 ); <span class="comment">// initialize the module to be in API mode</span>
    <span class="keywordflow">while</span>( 1 )
    {
      <span class="comment">// your task here.</span>
    }
  }
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00306">306</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="gbb8511090eee4d72a26bf55fb44bcd68"></a><!-- doxytag: member="xbee.c::XBeeConfig_SetPanID" ref="gbb8511090eee4d72a26bf55fb44bcd68" args="(uint16 id)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBeeConfig_SetPanID           </td>
          <td>(</td>
          <td class="paramtype">uint16&nbsp;</td>
          <td class="paramname"> <em>id</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set this PAN (Personal Area Network) ID. 
<p>
Only modules with matching PAN IDs can communicate with each other. Unique PAN IDs enable control of which RF packets are received by a module. Default is <b>0x3332</b>.<p>
As with the other <b>XBeeConfig</b> functions, make sure you're in API mode before trying to use this function. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>id</em>&nbsp;</td><td>A uint16 specifying the PAN ID. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a></dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <a class="code" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode</a>( );
  <a class="code" href="group___x_bee.html#gbb8511090eee4d72a26bf55fb44bcd68" title="Set this PAN (Personal Area Network) ID.">XBeeConfig_SetPanID</a>( 0x1234 );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00921">921</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g35826df514efda2aab33f86cf0e24f2e"></a><!-- doxytag: member="xbee.c::XBeeConfig_SetSampleRate" ref="g35826df514efda2aab33f86cf0e24f2e" args="(uint16 rate)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBeeConfig_SetSampleRate           </td>
          <td>(</td>
          <td class="paramtype">uint16&nbsp;</td>
          <td class="paramname"> <em>rate</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Set the rate at which the module will sample its IO pins. 
<p>
When the sample rate is set, the module will sample all its IO pins according to its current IO configuration and send a packet with the sample data. If this is set too low and the IO configuration is sampling too many channels, the RF module won't be able to keep up. You can also adjust how many samples are gathered before a packet is sent.<p>
As with the other <b>XBeeConfig</b> functions, make sure you're in API mode before trying to use this function. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>rate</em>&nbsp;</td><td>A uint16 specifying the sample rate in milliseconds. </td></tr>
  </table>
</dl>
<dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd>XBeeConfig_SetIOs( ), <a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a></dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <a class="code" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode</a>( );
  <a class="code" href="group___x_bee.html#g35826df514efda2aab33f86cf0e24f2e" title="Set the rate at which the module will sample its IO pins.">XBeeConfig_SetSampleRate</a>( 0x14 );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l01019">1019</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<a class="anchor" name="g60564c155b8d6a6e73a9bfa54917ebd2"></a><!-- doxytag: member="xbee.c::XBeeConfig_WriteStateToMemory" ref="g60564c155b8d6a6e73a9bfa54917ebd2" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void XBeeConfig_WriteStateToMemory           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td width="100%"></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Save the configuration changes you've made on the module to memory. 
<p>
When you make configuration changes - setting the module to API mode, or configuring the sample rate, for example - those changes will be lost when the module restarts. Call this function to save the current state to non-volatile memory.<p>
As with the other <b>XBeeConfig</b> functions, make sure you're in API mode before trying to use this function. <dl class="return" compact><dt><b>Returns:</b></dt><dd>True on success, false on failure. </dd></dl>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode( )</a></dd></dl>
<dl class="user" compact><dt><b>Example</b></dt><dd><div class="fragment"><pre class="fragment">  <a class="code" href="group___x_bee.html#gb3abc9b61091749d5aa7a48e8aa35e18" title="Set a module into packet API mode.">XBeeConfig_SetPacketApiMode</a>( );
  <a class="code" href="group___x_bee.html#g35826df514efda2aab33f86cf0e24f2e" title="Set the rate at which the module will sample its IO pins.">XBeeConfig_SetSampleRate</a>( 100 );
  <a class="code" href="group___x_bee.html#g60564c155b8d6a6e73a9bfa54917ebd2" title="Save the configuration changes you&amp;#39;ve made on the module to memory.">XBeeConfig_WriteStateToMemory</a>( );
</pre></div> </dd></dl>

<p>Definition at line <a class="el" href="xbee_8c-source.html#l00850">850</a> of file <a class="el" href="xbee_8c-source.html">xbee.c</a>.</p>

</div>
</div><p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Make Controller Kit</title>
<style type="text/css">
<!--
.footer {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 9pt;
	color: #999999;
}
-->
</style>
</head>

<body>
<hr size="1">
<div>
  <p class="footer">The Make Controller Kit is an open source project maintained by <a href="http://www.makingthings.com">MakingThings</a>.<br />
    MakingThings code is released under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html" target="_blank">Apache 2.0 license</a>.<br />
    Bug tracker, development wiki and status can be found at <a href="http://dev.makingthings.com">http://dev.makingthings.com</a>.<br />
		This document was last updated on 5 Dec 2007.
</p>
</div>
<!-- Google Analytics Code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-769030-1";
urchinTracker();
</script>
</body>
</html>
